import request from '@/utils/request'

export function listGoodsInfo(params) {
  return request({
    url: `/admin/api/yxStoreProduct`,
    method: 'get',
    params
  })
}

export function getGoodsInfo(id) {
  return request({
    url: `/admin/api/goods/${id}`,
    method: 'get'
  })
}

export function add(data) {
  return request({
    url: '/admin/api/yxStoreProduct',
    method: 'post',
    data
  })
}

export function del(id) {
  return request({
    url: '/admin/api/yxStoreProduct/' + id,
    method: 'delete'
  })
}

export function edit(data) {
  return request({
    url: '/admin/api/yxStoreProduct',
    method: 'put',
    data
  })
}

export function editGoodsStock(data) {
  return request({
    url: '/admin/api/goods/stock',
    method: 'put',
    data
  })
}

export function onsale(id, data) {
  return request({
    url: '/admin/api/yxStoreProduct/onsale/' + id,
    method: 'post',
    data
  })
}

export function recovery(id) {
  return request({
    url: '/admin/api/yxStoreProduct/recovery/' + id,
    method: 'delete'
  })
}
export function hotGoods() {
  return request({
    url: `/admin/api/hotGoods`,
    method: 'get'
  })
}
export function exportGoodsInfo(query) {
  return request({
    url: '/admin/api/goodsInfo/export',
    method: 'get',
    params: query,
    responseType: 'blob'
  })
}
